-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vehicles hear exterior audio #4815
Conversation
What do you mean by "FALSE is still counted as an object" ? FALSE is literally 0 which is falsey, this shouldn't change anything for the purposes of what's done here |
I might be using the wrong words here. What I mean is the sound code takes the return of Lines 83 to 84 in 5fbe143
It doesn't check if its |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me, thanks for the fix
Co-authored-by: harryob <[email protected]>
About the pull request
As described in issue #4777 while vehicle interiors are intended to hear external sounds, it is largely nonfunctional. Sounds are either not heard or are inaudibly quiet. This is due to several smaller issues working together.
First, interiors are not detected as interiors. In commit 0808500 the types stored in the
used_turfs
list were changed to weakrefs, but theis_interior()
function still checked for the old type, causing it to always returnFALSE
:cmss13/code/controllers/subsystem/interior.dm
Lines 54 to 58 in 5fbe143
Fixed by checking for the correct type.
Second, the
get_interior_by_coords()
function returned an object on success, but returnedFALSE
on failure - which still counted as an object. Since shuttles add turfs toused_turfs
but don't have actual interiors, they would passis_interior()
but failget_interior_by_coords()
. The sound code expected any object received at this point to be valid, but usingFALSE
would thrown an error:cmss13/code/game/sound.dm
Lines 82 to 84 in 5fbe143
Fixed by returning
null
on failure.Third, the audio was now playing but in the wrong part of the interior. It was offset to the top-right corner because
get_middle_coords()
got the difference between the bounds, but never actually averaged them:cmss13/code/modules/vehicles/interior/interior.dm
Line 321 in 5fbe143
Fixed by dividing the difference by two.
Fourth, the sound playback zone was oriented incorrectly because the width and height were transposed when creating the zone. Rectangles were defined as width then height, but the sound subsystem was passing height then width:
cmss13/code/controllers/subsystem/sound.dm
Line 44 in 5fbe143
Fixed by passing width then height.
Explain why it's good for the game
Vehicle interiors were intended to hear external sounds. This restores that functionality.
Testing Photographs and Procedure
Screenshots & Videos
Put screenshots and videos here with an empty line between the screenshots and the
<details>
tags.Changelog
🆑
fix: vehicle interiors can hear exterior noises
/:cl: